<template>
	<view class="page">
		<!-- tab切换 -->
		<view class="tab-wrap">
			<view class="end-title">
				<view v-for="(item,index) in items" :key="index" :class="{on:count == index}" @click.stop="tabChange(index)">
					{{item}}
				</view>
			</view>
			<view class="tab-cont">
				<!-- 搜索筛选 -->
				<view class="search-select">
					<view class="search">
						<view class="iconfont iconsearch"></view>
						<input type="text" value="" placeholder="请输入试题名称" placeholder-class="placeholder" />
					</view>
					<view class="select">
						<picker @change="bindPickerChange" :value="index" :range="array">
							<view class="uni-input" v-if="index == -1">历年试题</view>
							<view class="uni-input" v-else>{{array[index]}}</view>
							<view class="iconfont iconxxjtfull"></view>
						</picker>
					</view>
				</view>
				<view class="select-wrap">
					<ChooseLits :list="list" :arr="arr" @chooseLike="chooseLike"></ChooseLits>
				</view>
				<!-- 列表 -->
				<scroll-view scroll-y="true" class="scroll-Y list-wrap" @scrolltolower="lower" :style="{height:scrollH+'rpx'}">
					<navigator v-for="(index,item) in 3" :key="index" class="item" url="" hover-class="none">
						<view class="body">
							<view class="lf">
								<view class="icon-title">
									<image class="icon" src="../../static/bianji.png" mode=""></image>
									<view class="title">
										2020年重庆高考摸底考试试题(有原题)
									</view>
								</view>
								<view class="des">
									人教版/必修/第二单元/原题
								</view>
								<view class="tags">
									<text>2020</text>
									<text>全国</text>
								</view>
							</view>
							<view class="rt">
								<view class="price">
									￥56.00
								</view>
								<view class="type">
									视频讲解
								</view>
								<view class="price-s">
									￥14.00
								</view>
							</view>
						</view>
						<view class="foot">
							<view class="author">
								上传者:张**
							</view>
							<view class="time">
								2020/12/07 12:12:47
							</view>
							<view class="size">
								大小:87KB
							</view>
							<view class="download">
								下载:0次
							</view>
						</view>
					</navigator>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	import ChooseLits from '@/components/choose-Cade/choose-Cade.vue'
	export default {
		components: {
			ChooseLits
		},
		data() {
			return {
				btnnum: 0,
				items: ["真题", "大联考", "教案", "学习方法"],
				count: "",
				index: -1,
				array: ['2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04'],
				list: ['所属地区', '试题年份', '学科','年级'],
				arr: [
					['重庆', '四川', '北京'],
					['艺体生', '非艺体生'],
					['第一批', '第二批', '第三批'],
					['一月份', '二月份', '三月份','四月份','五月份']
				],
				i2: [0, 0, 0,0],
			}
		},
		computed: {
			scrollH: function() {
				let sys = uni.getSystemInfoSync();
				let winWidth = sys.windowWidth;
				let winrate = 750 / winWidth;
				let winHeight = parseInt(sys.windowHeight * winrate - 426)
				return winHeight
			}
		},
		methods: {
			//tab切换
			tabChange(e) {
				let that = this;
				that.count = e
				that.btnnum = e
				console.log(that.count)
			},
			bindPickerChange(e) {
				console.log('picker发送选择改变，携带值为', e.target.value)
				this.index = e.target.value
			},
			// select
			chooseLike(i1) {
				if (this.i2[i1[0]] != i1[1]) {
					this.i2[i1[0]] = i1[1];
				}
				console.log(this.i2)
			},
			lower(e) {
				console.log('到底了', e)
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import 'learningCenter.scss';
	@import '../../common/icon/iconfont.css';
</style>
